package com.gljx.web.controller;

import com.gljx.constant.ActivitiKey;
import com.gljx.util.*;
import com.gljx.web.Entity.*;
import com.gljx.web.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;


@Controller
@RequestMapping("/")
public class RemunProvideController {
    //自动注入
    @Autowired
    private DepartmentService departmentService;

    @Autowired
    private CustomLogService customLogService;

    @Autowired
    private RemunProvideService remunProvideService;

    @Autowired
    private PersonService personService;

    @Autowired
    private RemunProvideEntryService remunProvideEntryService;

    //自定义流程工具
    private Axamine axamine = new Axamine();

    //导入activiti工具
    ActitiviUtil activitiUtil = new ActitiviUtil();

    /**
     * 查找薪资发放信息
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/queryRemunProvide/look.action")
    public String queryRemunProvide(HttpServletRequest request, @RequestParam(value = "fnumber", defaultValue = "") String fnumber
            , @RequestParam(value = "type", defaultValue = "") String type) throws Exception {
        PageBean<RemunProvide> pb = new PageBean<>();
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        try {
            fnumber = fnumber.trim();//去空格
            if (fnumber != null && !fnumber.equals("")) {
                //页面搜索模糊查询
                //获取分页
                pb = getPageBean(request, user.getFcompanyid(), fnumber);
            } else {
                //获取分页
                pb = getPageBean(request, user.getFcompanyid(), null);
            }
            //获取当前分页的值
            List<RemunProvide> remunProvideList = pb.getBeanList();
            //把获取到的数据传回页面
            for (RemunProvide remunProvide : remunProvideList) {
                //查询对应员工的信息
                remunProvide.setRemunProvideEntryList(remunProvideEntryService.selectByFparentid(remunProvide.getFid()));
            }
            request.setAttribute("remunProvideList", remunProvideList);
            request.setAttribute("pb", pb);
            request.setAttribute("type", type);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "backHome/humanResource/remunProvide/remunProvideList";
    }

    /**
     * 跳转到增加薪资发放页面
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/intoAddRemunProvide")
    public String intoAddRemunProvide(HttpServletRequest request, String type) throws Exception {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取部门
        List<Department> departments = departmentService.queryAdminByController(user.getFcompanyid());
        //获取组织
        Department department = departmentService.queryAdminByFid(user.getFcompanyid());
        //获取属于组织的所有员工
        List<Person> personList = personService.selPersionByFcomanyid(user.getFcompanyid());
        //获取当前时间
        Calendar now = Calendar.getInstance();
        //获取年
        int year = now.get(Calendar.YEAR);
        //获取月
        int month = now.get(Calendar.MONTH) + 1;
        //获取日
        int day = now.get(Calendar.DAY_OF_MONTH);
        /*获取当前时间*/
        String createTime = TimeFormat.timeFormat(new Date());
        request.setAttribute("department", department);
        //获取最大编号
        /*String number=remunProvideService.selectFnumber(user.getFcompanyid());*/
        //获取编码
        String fnumber = GetFnumber.fnumbers("XCFF");
        request.setAttribute("createTime", createTime);
        request.setAttribute("fnumber", fnumber);
        request.setAttribute("department", department);
        request.setAttribute("year", year);
        request.setAttribute("month", month);
        request.setAttribute("day", day);
        request.setAttribute("personList", personList);
        request.setAttribute("createName", user.getName());
        request.setAttribute("type", type);
        return "backHome/humanResource/remunProvide/addRemunProvide";
    }

    /**
     * 增加薪酬薪资信息
     *
     * @param request
     * @param remunProvide
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/addRemunProvide")
    public String addRemunProvide(HttpServletRequest request, RemunProvide remunProvide) throws Exception {
        //获取需要发放工资的员工id
        String[] fids = request.getParameterValues("check");
        //获取发放的金额
        String[] cfamount = request.getParameterValues("cfamount");
        //获取员工姓名
        String[] personName = request.getParameterValues("personName");
        //获取员工的部门
        String[] cfpersondepName = request.getParameterValues("cfpersondepName");
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        remunProvide.setFcreatetime(TimeFormat.timeFormat(new Date()));
        remunProvide.setFid(GetFid.UUIDIntoFid());
        remunProvide.setFcontrolunitid(user.getFcompanyid());
        remunProvide.setFcreatorid(user.getFid());
        remunProvide.setCfficompanyid(user.getFcompanyid());
        remunProvide.setCreateName(user.getName());
        //添加薪酬薪资信息
        int row1 = 0;
        int row2 = 0;
        row1 = remunProvideService.addRemunProvide(remunProvide);
        //添加薪酬薪资明细信息

        for (int i = 0; i < fids.length; i++) {
            RemunProvideEntry remunProvideEntry = new RemunProvideEntry();
            remunProvideEntry.setFparentid(remunProvide.getFid());
            remunProvideEntry.setCfpersonid(fids[i]);
            remunProvideEntry.setCfpersonname(personName[i]);
            remunProvideEntry.setCfdepartment(cfpersondepName[i]);
            remunProvideEntry.setCfamount(new BigDecimal(cfamount[i] ));
            remunProvideEntry.setFid(GetFid.UUIDIntoFid());
            row2 += remunProvideEntryService.addRemunProvideEntry(remunProvideEntry);
        }

        String result = "";
        if (row1 > 0 && row2 > 0) {
            result = "1";
        }
        customLogService.addLog("人力资源", TimeFormat.timeFormat(new Date()) + "对薪酬发放进行增加操作", null, user.getFid());

        return "redirect:/DrivingSys/intoAddRemunProvide?type=" + result;
    }

    /**
     * 跳转到修改页面
     *
     * @param request
     * @param fid
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/intoUpdateRemunProvide")
    public String intoUpdateRemunProvide(HttpServletRequest request,
                                         @RequestParam(value = "fid", required = false) String fid) throws Exception {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取组织
        Department department = departmentService.queryAdminByFid(user.getFcompanyid());
	    /*获取当前时间*/
        String updateTime = TimeFormat.timeFormat(new Date());
        //根据fid获取薪酬薪资单据信息
        RemunProvide remunProvide = null;
        if (fid != null && !fid.equals("")) {
            remunProvide = remunProvideService.selRemunProvideByFid(user.getFcompanyid(), fid);
        }
        //获取该薪酬薪资单据的子类明细
        List<RemunProvideEntry> remunProvideEntryList = null;
        remunProvideEntryList = remunProvideEntryService.selectByFparentid(remunProvide.getFid());
        //拼接SQL语句
        StringBuffer psql = new StringBuffer();
        psql.append("select T.FID, T.FNUMBER,to_char(t.CFBIRTHDAY,'YYYY-MM-DD ') cfbirthdays,to_char(t.cfstartdate,'YYYY-MM-DD ') cfstartdate,");
        psql.append("to_char(t.cfenddate,'YYYY-MM-DD ') cfenddate,to_char(t.cfbegindate,'YYYY-MM-DD ') cfbegindate,to_char(t.CFHTDQSJ,'YYYY-MM-DD ') cfhtdqsj,");
        psql.append("T.CFIDCARDNO, T.CFCELL, T.CFADDRESS,T.CFPERSONTYPE, T.CFSEX,T.CFXCTZ, T.CFGWYD, T.CFQJJL, T.CFWJJLJL,p.fname_l2 as positiongradeName,t.cfaccountsno, ");
        psql.append("T.CFSHJLJL,T.FNAME_L2,T.CFZSTC,T.CFPXTC,A.FNAME_L2 AS CFPERSONDEPNAME,C.fnumber AS CFCARNAME from ct_ds_person t left join ");
        psql.append("CT_DS_ADMIN A ON A.FID=T.CFPERSONDEPID left join CT_DS_CAR C ON C.FID=T.CFCARID left join CT_DS_POSITIONGRADE p on t.cfjobgradeid=p.fid ");
        //查询职员
        List<Person> persons = personService.selectPerson(psql.toString());
        remunProvide.setRemunProvideEntryList(remunProvideEntryList);
        request.setAttribute("remunProvide", remunProvide);
        request.setAttribute("department", department);
        request.setAttribute("user", user);
        request.setAttribute("persons", persons);
        request.setAttribute("updateTime", updateTime);
        return "backHome/humanResource/remunProvide/updateRemunProvide";
    }

    /**
     * 修改薪酬信息信息
     *
     * @param request
     * @param remunProvide
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/updateRemunProvide")
    public String updateRemunProvide(HttpServletRequest request, RemunProvide remunProvide) throws Exception {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取需要发放工资的员工id
        String[] fids = request.getParameterValues("personid");
        //获取发放的金额
        String[] cfamount = request.getParameterValues("cfamount");
        //获取员工姓名
        String[] personName = request.getParameterValues("personName");
        //获取员工的部门
        String[] cfpersondepName = request.getParameterValues("cfpersondepName");
	    /*获取当前时间*/
        String updateTime = TimeFormat.timeFormat(new Date());
        remunProvide.setFlastupdatetime(updateTime);
        //先删除对应该条薪酬薪资的所有明细信息
        if (remunProvide.getFid() != null && !remunProvide.getFid().equals("")) {
            remunProvideEntryService.deleteByParentId(remunProvide.getFid());
        }
        //修改薪酬薪資信息
        int row1 = remunProvideService.updateByPrimaryKeySelective(remunProvide);
        int row2 = 0;
        //再新增薪酬信息明细
        RemunProvideEntry remunProvideEntry = new RemunProvideEntry();
        if (fids != null && cfamount != null && personName != null && cfpersondepName != null) {
            for (int i = 0; i < fids.length; i++) {
                remunProvideEntry.setFparentid(remunProvide.getFid());
                remunProvideEntry.setFid(fids[i]);
                remunProvideEntry.setCfpersonname(personName[i]);
                remunProvideEntry.setCfdepartment(cfpersondepName[i]);
                remunProvideEntry.setCfamount(new BigDecimal(cfamount[i]));
                remunProvideEntry.setFid(GetFid.UUIDIntoFid());
                row2 += remunProvideEntryService.addRemunProvideEntry(remunProvideEntry);
            }
        }
        String result = "";
        if (row1 > 0 && row2 > 0) {
            result = "1";
        }
        customLogService.addLog("人力资源", updateTime + "对薪酬发放进修改操作", null, user.getFid());
        return "redirect:/DrivingSys/queryRemunProvide/look.action?type=" + result;
    }

    /**
     * 根据fid删除薪酬薪资信息
     *
     * @param request
     * @param deleteId
     * @param fid
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteRemunProvideByFid")
    public String deleteRemunProvide(HttpServletRequest request, String[] deleteId, String fid) throws Exception {
        User user = (User) request.getSession().getAttribute("user");
        //删除记录
        if (fid == null || fid.equals("")) {
            for (int i = 0; i < deleteId.length; i++) {
	            /*过滤为空的删除操作*/
                if (!deleteId[i].equals("") && deleteId[i] != null) {
                    //根据fid查找单据编号
                    RemunProvide remunProvide = remunProvideService.selRemunProvideByFid(null, deleteId[i]);
                    //删除历史流程或者进行中的流程
                    activitiUtil.deleteTask(ActivitiKey.PUBLIC_KEY, remunProvide.getFnumber());
                    remunProvideService.deleteByPrimaryKey(deleteId[i]);//删除父类
                    remunProvideEntryService.deleteByParentId(deleteId[i]);//删除子类
                }
            }
        } else {
            //根据fid查找单据编号
            RemunProvide remunProvide = remunProvideService.selRemunProvideByFid(null, fid);
            //删除历史流程或者进行中的流程
            activitiUtil.deleteTask(ActivitiKey.PUBLIC_KEY, remunProvide.getFnumber());
            remunProvideService.deleteByPrimaryKey(fid);
            remunProvideEntryService.deleteByParentId(fid);//删除子类
        }
        //添加日志
        customLogService.addLog("人力资源", TimeFormat.timeFormat(new Date()) + "薪酬发放进行删除", null, user.getFid());
        return "redirect:/DrivingSys/queryRemunProvide/look.action";
    }

    /**
     * 提交单据
     *
     * @param fid
     * @param request
     * @param fnumber
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "submitRemunProvideActiviti")
    @ResponseBody
    public Object submitRemunProvideActiviti(String fid, HttpServletRequest request, String fnumber) throws Exception {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        RemunProvide remunProvide = new RemunProvide();
        remunProvide.setFid(fid);
        remunProvide.setCfbillstate(4L);
        remunProvide.setFlastupdateuserid(user.getFid());
        //创建流程
        axamine.submissionProcess(fnumber);
        int row = remunProvideService.updateByPrimaryKeySelective(remunProvide);
        String result = "failed";
        if (row > 0) {
            result = "success";
        }
        Map<String,String> _map =new HashMap<>();
        _map.put("result",result);
        return _map;
    }

    /**
     * 审核单据
     *
     * @param request
     * @param fid
     * @param agree
     * @param auditcomment
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "checkRemunProvideActiviti")
    @ResponseBody
    public Object checkRemunProvideActiviti(HttpServletRequest request, String fnumber, String fid, String agree, String auditcomment) throws Exception {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        RemunProvide remunProvide = new RemunProvide();
        //获取当前修改时间
        String updateTime = TimeFormat.timeFormat(new Date());
        String result = "failed";
        int row1 = 0;
        if (agree.equals("1")) {//同意
            ServerResponse serverResponse = axamine.auditProcess(fnumber, agree, auditcomment);
            if (serverResponse.getStatus() == 1) {//结束
                remunProvide.setFid(fid);
                remunProvide.setCfbillstate(5L);
                remunProvide.setFdescription(auditcomment);
                remunProvide.setFlastupdateuserid(user.getFid());
                remunProvide.setFauditorid(user.getFid());
                row1 = remunProvideService.updateByPrimaryKeySelective(remunProvide);
                if (row1 > 0) {//修改单据
                    result = "success";
                }
            } else if (serverResponse.getStatus() == 2) {
                result = "success";
            } else {

            }
        } else {
            ServerResponse serverResponse = axamine.auditProcess(fnumber, agree, auditcomment);
            if (serverResponse.getStatus() == 2) {
                remunProvide.setFid(fid);
                remunProvide.setCfbillstate(3L);
                remunProvide.setFlastupdateuserid(user.getFid());
                remunProvide.setFauditorid(user.getFid());
                //修改父类
                row1 = remunProvideService.updateByPrimaryKeySelective(remunProvide);
                if (row1 > 0) {
                    result = "success";
                }
            }
        }
        Map<String,String> _map =new HashMap<>();
        _map.put("result",result);
        return _map;
    }

    /**
     * 反审核单据
     *
     * @param request
     * @param fid
     * @param againstAuditcomment
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "againstRemunProvideActiviti")
    @ResponseBody
    public Object againstRemunProvideActiviti(HttpServletRequest request, String fid, String fnumber, String againstAuditcomment) throws Exception {
        //获取当前登录用户的信息
        User user = (User) request.getSession().getAttribute("user");
        String result = "falied";
        //将单据状态修改成保存状态3
        RemunProvide remunProvide = new RemunProvide();
        remunProvide.setFid(fid);
        remunProvide.setCfbillstate(3L);//保存状态
        remunProvide.setFdescription(againstAuditcomment);
        remunProvide.setFauditorid(user.getFid());//设置反审计人id
        int row = remunProvideService.updateByPrimaryKeySelective(remunProvide);
        axamine.againstAuditProcess(fnumber, againstAuditcomment);
        if (row > 0) {
            result = "success";
        }
        Map<String,String> _map =new HashMap<>();
        _map.put("result",result);
        return _map;
    }


    @SuppressWarnings("unchecked")
    /**
     * 返回PageBean实体类  包括记录总数，页码，每页记录集等  dmz 20160921
     * @return 返回PageBean实体类
     * @throws Exception
     */
    public PageBean<RemunProvide> getPageBean(HttpServletRequest request, String companyId, String fnumber) throws Exception {

        int offset;//从第几条数据开始加载
        if (request.getParameter("pager.offset") == null) {
            offset = 0;
        } else {
            offset = Integer.parseInt(request.getParameter("pager.offset"));
        }
        //拼接SQL语句
        StringBuffer psql = new StringBuffer();
        if (fnumber == null) {
            psql.append("SELECT R.fid, R.FNUMBER, TO_CHAR(R.FBIZDATE, 'YYYY-MM-DD ') FBIZDATE, R.CFYEAR, R.CFMONTH, R.FDESCRIPTION, R.CFBILLSTATE, u.NAME AS checkName, e.NAME AS createName, " +
                    " a.FNAME_L2 as drivingSchool FROM CT_DS_REMUNPROVIDE R LEFT JOIN T_E_USER e on R.FCREATORID=e.fid  LEFT JOIN T_E_USER u  on R.FAUDITORID=u.fid " +
                    "LEFT JOIN CT_DS_ADMIN a  on a.fid='" + companyId + "'");
            psql.append(" where R.FCONTROLUNITID= '" + companyId + "' ORDER BY FBIZDATE DESC");
        } else {
            psql.append("SELECT R.fid, R.FNUMBER, TO_CHAR(R.FBIZDATE, 'YYYY-MM-DD ') FBIZDATE, R.CFYEAR, R.CFMONTH, R.FDESCRIPTION, R.CFBILLSTATE, u.NAME AS checkName, e.NAME AS createName, " +
                    " a.FNAME_L2 as drivingSchool FROM CT_DS_REMUNPROVIDE R LEFT JOIN T_E_USER e on R.FCREATORID=e.fid  LEFT JOIN T_E_USER u  on R.FAUDITORID=u.fid " +
                    "LEFT JOIN CT_DS_ADMIN a  on a.fid='" + companyId + "'");
            psql.append(" where R.FNUMBER like '%" + fnumber + "%' AND R.FCONTROLUNITID= '" + companyId + "' ORDER BY FBIZDATE DESC");
        }

        int psize = 10; //每页显示数
        int pindex = offset / psize;//+1  页码从0开始
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap = remunProvideService.selectPage(pindex, psql.toString(), psize);
        PageBean<RemunProvide> pb = new PageBean<>();
        pb.setPc(pindex); //页码
        Map<String, Object> paramMapCount = getPageBeanCount(psql.toString()); //取记录总数
        pb.setTr((int) paramMapCount.get("Pcount")); //记录总数
        pb.setPs(psize);
        pb.setBeanList((List<RemunProvide>) paramMap.get("v_cur")); //每页数据集
        return pb;
    }
	
    /*public PageBean<Person> getPageBean2(HttpServletRequest request, String fid) throws Exception {

        int offset;//从第几条数据开始加载
        if (request.getParameter("pager.offset") == null) {
            offset = 0;
        } else {
            offset = Integer.parseInt(request.getParameter("pager.offset"));
        }
        String psql = "SELECT S.fid,S.FNAME_L2,S.fnumber,S.FSIMPLENAME,S.FDESCRIPTION_L2," +
                "  TO_CHAR(S.FCREATETIME, 'YYYY-MM-DD HH:MI:SS') FCREATETIME," +
                " u.NAME createName," +
                "  TO_CHAR(S.FLASTUPDATETIME, 'YYYY-MM-DD HH:MI:SS') FLASTUPDATETIME," +
                "  N.NAME updateName,A.FNAME_L2 FCONTROLUNITID,S.CFIDCARDNO ,TO_CHAR(S.CFBIRTHDAY, 'YYYY-MM-DD') CFBIRTHDAY," +
                "  S.CFADDRESS,S.CFLINKADDRESS,S.CFSJHM,S.CFLXDH,S.CFSLLX,S.CFXZJCXDH, " +
                "  S.CFSLZJCXDH,TO_CHAR(S.FCREATETIME, 'YYYY-MM-DD') FCREATETIME " +
                " FROM CT_DS_STUDENT S " +
                "  LEFT JOIN T_E_USER U ON s.FCREATORID = U.FID " +
                "  LEFT JOIN T_E_USER N ON s.FLASTUPDATEUSERID = N.FID " +
                "  LEFT JOIN CT_DS_ADMIN A ON s.FCONTROLUNITID = a.FID ";
        int psize = 15; //每页显示数
        int pindex = offset / psize;//+1  页码从0开始
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap = personService.selectPage(pindex, psql, psize);
        PageBean<Person> pb = new PageBean<>();
        pb.setPc(pindex); //页码
        Map<String, Object> paramMapCount = getPageBeanCount(psql); //取记录总数
        pb.setTr((int) paramMapCount.get("Pcount")); //记录总数
        pb.setPs(psize);
        pb.setBeanList((List<Person>)paramMap.get("v_cur")); //每页数据集
        return pb;

    }*/

    /**
     * 取记录总数 dmz 20160921
     *
     * @param psql SQL语句
     * @return Map
     * @throws Exception
     */
    public Map<String, Object> getPageBeanCount(String psql) throws Exception {

        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap = remunProvideService.selectPageCount(psql);
        return paramMap;
    }


    /**
     * 人力资源 薪酬发放 excel导出
     *
     * @param response
     * @param request
     * @param fnumber
     */
    @RequestMapping(value = "/importRemunProvide")
    public void importRemunProvide(HttpServletResponse response, HttpServletRequest request, String fnumber) {
        //获取操作人信息
        User user = (User) request.getSession().getAttribute("user");
        //获取组织
        Department department = departmentService.queryAdminByFid(user.getFcompanyid());
        //定义接收类型
        List<Object> data = new ArrayList<>();
        //查询数据
        List<RemunProvide> remunProvides = remunProvideService.selRemunProvideByFnumber(fnumber, user.getFcompanyid());
        for (RemunProvide remunProvide : remunProvides) {
            //查询对应员工的信息
            remunProvide.setRemunProvideEntryList(remunProvideEntryService.selectByFparentid(remunProvide.getFid()));
        }
        for (RemunProvide remunProvide : remunProvides) {
            for (int i = 0; i < remunProvide.getRemunProvideEntryList().size(); i++) {
                data.add(department.getFnameL2());
                data.add(remunProvide.getFnumber());
                data.add(remunProvide.getFbizdate());
                data.add(remunProvide.getFsourcefunction());
                data.add(remunProvide.getCheckName());
                data.add(remunProvide.getCreateName());
                if (remunProvide.getCfbillstate() == 3L) {
                    data.add("保存");
                } else if (remunProvide.getCfbillstate() == 4L) {
                    data.add("提交");
                } else {
                    data.add("审核");
                }
                data.add(remunProvide.getRemunProvideEntryList().get(i).getFnumber());
                data.add(remunProvide.getRemunProvideEntryList().get(i).getCfpersonname());
                data.add(remunProvide.getRemunProvideEntryList().get(i).getCfdepartment());
                data.add(remunProvide.getRemunProvideEntryList().get(i).getCfamount());
            }
        }
        //头部数据
        String head[] = {"驾校", "编码", "业务日期", "参考信息", "审核人名称", "制单人名称", "单据状态", "员工编号", "员工姓名", "员工部门", "工资"};
        //长度
        Integer length[] = {9000, 5000, 5000, 5000, 3000, 3000, 3000, 3000, 3000, 3000, 3000};
        try {
            //导出Excel
            CommonExport.importExcel(response, "薪酬发放" + TimeFormat.getNowTime2() + ".xls", "薪酬发放", data, head, length);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
